<div id="document-list">
<TABLE cellpadding=5 cellspacing=0>
<TR>
    <TH>Title</TH>
    <TH>State</TH>
    <TH>Author</TH>
    <th>Comments</th>
    <th>Ayes</th>
    <th>Nays</th>
    <th>Votes</th>
</TR>
<% @documents.each do |doc| %>
    <TR VALIGN="top" class="<%= cycle('list-line-odd', 'list-line-even') %>" >
        <TD><%= link_to doc.title, :action => 'show', :id => doc %></TD>
        <TD><%= doc.document_state.name %></TD>
        <TD><%= User.find(doc.user_id).login %></TD>
        <td><%= doc.comments.count %></td>
        <td><%= doc.votes_for -%></td>
        <td><%= doc.votes_against -%></td>
        <td><%= doc.votes_count -%></td>
    </TR>
<% end %>
</TABLE>
</div>

<% if logged_in? -%>
<p>
<%= link_to "New Document", :action => :new %>
</p>
<% end %>